package com.example.test.启动线程.LockSupport;

import java.util.concurrent.locks.LockSupport;

public class LockTsk implements Runnable {
    @Override
    public void run() {
        System.out.println("等待前");
        LockSupport.park();
        System.out.println("等待后");

    }

    public static void main(String[] args) {
        LockTsk lockTsk = new LockTsk();
        Thread thread = new Thread(lockTsk);
        thread.start();
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        LockSupport.unpark(thread);
    }
}
